//
//  LZBigPicView.m
//  DoctorFAQs
//
//  Created by langZai on 2017/3/22.
//  Copyright © 2017年 zjq. All rights reserved.
//

#import "LZBigPicView.h"

@implementation LZBigPicView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // 灰色背景
        self.backgroundColor = [UIColor colorWithRed:28/255.0 green:28/255.0 blue:28/255.0 alpha:0.4];
        
        _bigPicView = [[UIImageView alloc] init];
        [self addSubview:_bigPicView];
        [_bigPicView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.width.offset(SCREEN_Width);
            make.height.offset(SCREEN_Height - 200*ysIZE);
            make.center.equalTo(self);
        }];
        // 添加手势
        [self addTheTap];
    }
    return self;
}

- (void)setLzPicModel:(LZPicModel *)lzPicModel {
    _lzPicModel = lzPicModel;
    [_bigPicView sd_setImageWithURL:[NSURL URLWithString:_lzPicModel.img_max]];
    [YJProgressHUD showMessage:@"加载成功" inView:self];
}

// 灰色部分手势
- (void)addTheTap {
    UITapGestureRecognizer *tapGesture=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(event:)];
    tapGesture.delegate = self;
    [self addGestureRecognizer:tapGesture];
}
- (void)event:(UITapGestureRecognizer *)gesture {
    [self removeFromSuperview];
}



@end
